﻿<UserControl
    x:Class="Results.Views.PlayersView"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Icons="clr-namespace:Results.Icons"
    mc:Ignorable="d">
    <Grid
        x:Name="LayoutRoot"
        Background="{x:Null}">
        <ScrollViewer
            HorizontalAlignment="Left">
            <ItemsControl
                x:Name="Players"
                ItemsSource="{Binding Players}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button
                            Command="{Binding PlayerSelected}">
                            <StackPanel
                                Orientation="Horizontal">
                                <Icons:PlayerIcon
                                    Width="12"
                                    Height="20"
                                    VerticalAlignment="Center"
                                    Margin="2,0,6,0"
                                    Gender="{Binding Gender}" />
                                <StackPanel
                                    Orientation="Vertical">
                                    <TextBlock
                                        Text="{Binding LastName}"
                                        VerticalAlignment="Center"
                                        Width="100"
                                        FontWeight="Bold" />
                                    <TextBlock
                                        Text="{Binding FirstName}"
                                        VerticalAlignment="Center"
                                        Width="100" />
                                </StackPanel>
                            </StackPanel>
                        </Button>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controlsToolkit:WrapPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</UserControl>
